SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX {IB_CPPEXTRAFLAG}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX {IB_CPPEXTRAFLAG}")

SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} {IB_CPPEXTRAFLAG}")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} {IB_CPPEXTRAFLAG}")

INCLUDE_DIRECTORIES("{SOURCE_DIR}"
                    "{SOURCE_DIR}/system"
                    "{MYSQL_DIR}/sql"
                    "{MYSQL_DIR}/regex"
                    "{MYSQL_DIR}/include"
                    "{MYSQL_DIR}/extra/yassl/include"
                    "{MYSQL_DIR}/extra/yassl/taocrypt/include"
				            "{SOURCE_DIR}/{EDITION}"
                    "{BOOST_DIR}")

file( GLOB SYSTEM_SRCS "{SOURCE_DIR}/system/*.cpp" )
file( GLOB SYSTEM_SRCS_WINDOWS "{SOURCE_DIR}/system/windows/*.cpp" )
file( GLOB SYSTEM_SRCS_EDITION "{SOURCE_DIR}/{EDITION}/edition/system/*.cpp" )
file( GLOB SYSTEM_HDRS "{SOURCE_DIR}/system/*.h" )
file( GLOB SYSTEM_HDRS_WINDOWS "{SOURCE_DIR}/system/windows/*.h" )
file( GLOB SYSTEM_HDRS_EDITION "{SOURCE_DIR}/{EDITION}/edition/system/*.h" )

ADD_LIBRARY(bh-system
						${SYSTEM_SRCS}
						${SYSTEM_SRCS_EDITION}
						${SYSTEM_SRCS_WINDOWS}
						${SYSTEM_HDRS}
						${SYSTEM_HDRS_EDITION}
						${SYSTEM_HDRS_WINDOWS})

add_dependencies( bh-system GenError )

set( WITH_EMBEDDED {withEmbedded} )

if ( WITH_EMBEDDED )
ADD_LIBRARY(bh-system-embedded
						${SYSTEM_SRCS}
						${SYSTEM_SRCS_EDITION}
						${SYSTEM_SRCS_WINDOWS}
						${SYSTEM_HDRS}
						${SYSTEM_HDRS_EDITION}
						${SYSTEM_HDRS_WINDOWS})
add_dependencies( bh-system-embedded GenError )


set_target_properties(bh-system-embedded PROPERTIES COMPILE_DEFINITIONS EMBEDDED_LIBRARY)
endif()

set( WITH_DATAPROCESSOR {withDataprocessor} )

if ( WITH_DATAPROCESSOR )
ADD_LIBRARY(bh-system-pure
						${SYSTEM_SRCS}
						${SYSTEM_SRCS_EDITION}
						${SYSTEM_SRCS_WINDOWS}
						${SYSTEM_HDRS}
						${SYSTEM_HDRS_EDITION}
						${SYSTEM_HDRS_WINDOWS})
add_dependencies( bh-system-pure GenError )


set_target_properties(bh-system-pure PROPERTIES COMPILE_DEFINITIONS PURE_LIBRARY)
endif()

# vim: ft=cmake
